import {
  baseURL,
  scbaseURL
} from './config.js'

export default function(options) {
  return new Promise((resolve, reject) => {
    uni.request({
      url: options.type == 'sc' ?  scbaseURL + options.url : baseURL + options.url,
			// url: options.url,
      method: options.method || 'get',
      header: options.headers || {'content-type': 'application/json'},
      data: options.data || {},
      dataType: options.dataType || 'json',
      success: resolve,
      fail: reject
    })
  })
}
